<?php
/**
 * 输出函数库
 *
 * @author  web_dxj@163.com
 * @time    2015-10-08 09:42
 */

if ( ! function_exists('json_return') )
{

    function json_return ($data)
    {
        header('Content-Type:text/html; charset=utf-8');
        exit(json_encode($data));
    }

}

if ( ! function_exists('xml_return') )
{

    function xml_return ($data)
    {
        header('Content-Type:text/xml; charset=utf-8');
        exit(xml_encode($data));
    }

}

if ( ! function_exists('ajax_return') )
{
    function ajax_return ($result_code, $result_msg ='', $result_data = '')
    {
        json_return(
            array (
                'resultCode' => $result_code,
                'resultMsg'  => $result_msg,
                'resultData' => $result_data
            )
        );
    }
}